<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
		<style>
			
		</style>
		<script>
			

			/*
				遍历数组
					1. 下标
					2. 下标对应的值

				forEach()
				map()
				filter
				every
				some
			*/

			/*var arr = [1,2,3];
			// 会把回调函数的返回值放在新数组中
			let newArr = arr.map(function (item,index){
				console.log(item,index);
				return item * 2;	
			});

			console.log(newArr);*/

			let arr = [
				{
					name: 'leo'
				},
				{
					name: 'momo'
				}
			]

			let newArr = arr.map(function (item){
				return {
					...item,
					age:10
				}	
			})

			console.log(newArr);




		</script>
	</head>

	<body>
		
	</body>
</html>